home *** CD-ROM | disk | FTP | other *** search
- /*
- File: Initialize.c
-
- Contains: Initialization code for this application
-
- Written by: Chris White
-
- Copyright: Copyright © 1995-1999 by Apple Computer, Inc., All Rights Reserved.
-
- You may incorporate this Apple sample source code into your program(s) without
- restriction. This Apple sample source code has been provided "AS IS" and the
- responsibility for its operation is yours. You are not permitted to redistribute
- this Apple sample source code as "Apple sample source code" after having made
- changes. If you're going to re-distribute the source, we require that you make
- it clear in the source that the code was descended from Apple sample source
- code, but that you've made changes.
-
- Change History (most recent first):
- 7/21/1999 Karl Groethe Updated for Metrowerks Codewarror Pro 2.1
-
-
- */
- #pragma segment Initialize
-
-
-
- // System includes
-
- #ifndef __QUICKDRAW__
- #include <Quickdraw.h>
- #endif
-
- #ifndef __FONTS__
- #include <Fonts.h>
- #endif
-
- #ifndef __TEXTEDIT__
- #include <TextEdit.h>
- #endif
-
- #ifndef __DIALOGS__
- #include <Dialogs.h>
- #endif
-
- #ifndef __GESTALT__
- #include <Gestalt.h>
- #endif
-
- #ifndef __SEGLOAD__
- #include <SegLoad.h>
- #endif
-
-
-
-
- // Application includes
-
- #ifndef __BAREBONES__
- #include "BareBones.h"
- #endif
-
- #ifndef __PROTOTYPES__
- #include "Prototypes.h"
- #endif
-
-
-
- // static prototypes
- static Boolean CheckConfiguration ( void );
-
-
-
-
- void InitToolbox ( void )
- {
-
- InitGraf ( &qd.thePort );
- InitFonts ( );
- InitWindows ( );
- InitMenus ( );
- TEInit ( );
- InitDialogs ( nil );
- InitCursor ( );
-
- FlushEvents ( everyEvent, 0 );
-
- return;
- }
-
-
-
- void InitApplication ( void )
- {
- SetMenuBar ( GetNewMBar ( kMenuBarID ) );
- AppendResMenu ( GetMenuHandle ( kAppleMenu ), 'DRVR' );
- DrawMenuBar ( );
-
- if ( !CheckConfiguration ( ) )
- {
- AlertUser ( kNeedSystem7, 0, nil );
- ExitToShell ( );
- }
-
- gQuit = false; // Initialize flag that controls main event loop
- gSleepTime = kSleepTime;
-
- InstallAppleEventHandlers ( );
- CreateWindow ( );
-
- return;
- }
-
-
-
- static Boolean CheckConfiguration ( void )
- {
- long theResult;
- OSErr theErr;
- Boolean bHasAppleEvents;
-
-
- // Verify that we can run on the current configuration
-
- // We require AppleEvent Manager and FSSpec-based file traps and Standard File
- theErr = Gestalt ( gestaltAppleEventsAttr, &theResult );
- bHasAppleEvents = (theErr == noErr && (theResult & (1L << gestaltAppleEventsPresent)));
-
- return bHasAppleEvents;
- }
-
-
-
-
-